import requestHttp from '@/utils/requestHttp.js'
import requestUpload from '@/utils/requestUpload.js'
const createApi = (store) => ({
  autoLogin: (data) => requestHttp({ url: '/mini/login_by_code/', method: 'post', data, store }),
  setAvatar: (data) => requestHttp({ url: '/mini/user/set_avatar/', method: 'post', data, store }),
  uploadFile: (data) => requestHttp({ url: '/mini/upload_file/', method: 'post', data, store }),
  setNikeName: (data) => requestHttp({ url: '/mini/user/set_nick_name/', method: 'post', data, store }),
  currentUser: (data) => requestHttp({ url: '/mini/user/current_user/', method: 'get', data, store }),
  accountHistory: (data) => requestHttp({ url: '/mini/user/account_history/', method: 'get', data, store }),
  userAccount: (data) => requestHttp({ url: '/mini/user/user_account/', method: 'get', data, store }),
  joinHistory: (data) => requestHttp({ url: '/mini/user/join_lucky/', method: 'get', data, store }),
  luckyCash: (data) => requestHttp({ url: '/mini/user/lucky_cash/', method: 'post', data, store }),
  // signHistory: (data) => requestHttp({ url: '/mini/user/sign_in_by_limit/', method: 'get', data, store }),
  signHistory: (data) => requestHttp({ url: '/mini/user/sign_in_by_week/', method: 'get', data, store }),
  signIn: (data) => requestHttp({ url: '/mini/sign_in/', method: 'post', data, store }),
  luckyCurrent: (data) => requestHttp({ url: '/mini/lucky/current/', method: 'get', data, store }),
  lastCurrent: (data) => requestHttp({ url: '/mini/lucky/last_current/', method: 'get', data, store }),
  luckHistory: (data) => requestHttp({ url: '/mini/lucky/history/', method: 'get', data, store }),
  luckPreview: (data) => requestHttp({ url: '/mini/lucky/preview/', method: 'get', data, store }),
  luckyBuy: (resId, data) => requestHttp({ 
    url: `/mini/lucky/buy/${resId}/`, // 在方法内部拼接 URL
    method: 'post', 
    data, 
    store 
  }),
  lucky_user_count: (resId, data) => requestHttp({ 
    url: `/mini/lucky/user_count/${resId}/`, // 在方法内部拼接 URL
    method: 'get', 
    data, 
    store 
  }),
  lucky_user_nums: (resId, data) => requestHttp({ 
    url: `/mini/lucky/nums/${resId}/`, // 在方法内部拼接 URL
    method: 'get', 
    data, 
    store 
  }),
  lucky_avatar: (resId, data) => requestHttp({ 
    url: `/mini/lucky/show_avatar/${resId}/`, // 在方法内部拼接 URL
    method: 'get', 
    data, 
    store 
  }),
  lucky_cur_user_nums: (resId, data) => requestHttp({ 
    url: `/mini/lucky/user_nums/${resId}/`, // 在方法内部拼接 URL
    method: 'get', 
    data, 
    store 
  }),
  lucky_detail: (resId, data) => requestHttp({ 
    url: `/mini/lucky/item/${resId}/`, // 在方法内部拼接 URL
    method: 'get', 
    data, 
    store 
  }),
  
  
  wxLoginByPhone: (data) => requestHttp({ url: '/wechat/login', method: 'post', data, store }),
  wxGetUserInfo: (data) => requestHttp({ url: '/wechat/getUserInfo', method: 'post', data, store }),
  logout: (data) => requestHttp({ url: '/logout', method: 'post', data, store }),
  qnUptoken: (data) => requestHttp({ url: '/file/uptoken', method: 'post', data, store }),
  uploadQN: (filePath,data) => requestUpload({ url: '/file/upload', filePath, data, store }),
  deleteQN: (data) => requestHttp({ url: '/file/delete', method: 'post', data, store }),
});
export default createApi;